package com.ruoyi.system.domain;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.system.enums.RestaurantStatusEnum;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.data.annotation.Transient;

/**
 * 餐饮对象 restaurant
 *
 * @author 强盛酒店
 * @date 2023-03-08
 */
public class Restaurant extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 餐饮id
     */
    private Long id;

    /**
     * 餐饮名称
     */
    @Excel(name = "餐饮名称")
    private String name;

    /**
     * 餐饮价格
     */
    @Excel(name = "餐饮价格")
    private String price;

    /**
     * 餐饮图片
     */
    @Excel(name = "餐饮图片")
    private String picture;

    /**
     * 库存数量
     */
    @Excel(name = "库存数量")
    private Integer stockNum;

    /**
     * 状态 0 上架 1下架
     */
    @Excel(name = "状态 0 上架 1下架")
    private Integer status;

    /**
     * 创建人
     */
    @Excel(name = "创建人")
    private Long createUser;

    /**
     * 修改人
     */
    @Excel(name = "修改人")
    private Long updateUser;

    /**
     * 是否已删除
     */
    @Excel(name = "是否已删除")
    private Integer isDeleted;

    @Transient
    private String statusName;

    @Transient
    private String pic;

    @Transient
    private Integer num;

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getPic() {
        if (picture != null) {
            pic = "http://localhost:8080" + picture;
        }
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public String getStatusName() throws Exception {
        if (status != null) {
            statusName = RestaurantStatusEnum.getEnum(status).getName();
        }
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getPrice() {
        return price;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getPicture() {
        return picture;
    }

    public void setStockNum(Integer stockNum) {
        this.stockNum = stockNum;
    }

    public Integer getStockNum() {
        return stockNum;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }

    public void setCreateUser(Long createUser) {
        this.createUser = createUser;
    }

    public Long getCreateUser() {
        return createUser;
    }

    public void setUpdateUser(Long updateUser) {
        this.updateUser = updateUser;
    }

    public Long getUpdateUser() {
        return updateUser;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("price", getPrice())
                .append("picture", getPicture())
                .append("stockNum", getStockNum())
                .append("status", getStatus())
                .append("createUser", getCreateUser())
                .append("createTime", getCreateTime())
                .append("updateUser", getUpdateUser())
                .append("updateTime", getUpdateTime())
                .append("isDeleted", getIsDeleted())
                .toString();
    }
}
